/**
 * Created by Administrator on 2017-08-05.
 */
var ids;
$(function () {
    // if (ids != "") {
    $.ajax({
        url: "apis/cuswx/getAboutMessage",
        type: 'post',
        data: JSON.stringify({}),
        dataType: 'json',
        async: false,
        contentType : 'application/json',
        success: function (res) {
                  // console.log(res);

            var ueditor = UE.getEditor('editor', {});
            ueditor.addListener("ready", function () {
                // editor准备好之后才可以使用
                ueditor.setContent(res.data.aboutMsg);
                var content = UE.getEditor('editor').getContent();
            });
        }
    })

})
//提交添加内容
$("#addContent").click(function () {
    var content = UE.getEditor('editor').getContent();
    // console.log(content);
    if (content == "" || content == null) {
        var data1 = {
            "contentURL": 0
        }
    } else {
        var data1 = {
            "msgContent": content
        }
    }
    // console.log(data1);
    $.ajax({
        type: "post",
        contentType: 'application/json',
        url: "apis/cuswx/setAboutMessage",
        data: JSON.stringify(data1),
        dataType: "json",
        contentType : 'application/json',
        success: function (res) {
            // console.log(res);
            if (res.httpCode == 200) {
                alert("添加成功");
                $("#editDiadog").hide();
                $("#gray_bg").hide();
                window.location.reload();
            } else {
                alert(res.msg);
            }
        }

    });
})
